/** Copyright (c) 2015—2017 Zerone.Co.Ltd. All rights reserved. */
package com.zerone.pay.merchant.repository.entity;

import com.acooly.core.common.domain.AbstractEntity;
import com.zerone.facade.merchant.enums.MerchantTypeEnum;
import com.zerone.payment.common.facade.enums.BankCardTypeEnum;
import com.zerone.payment.common.facade.enums.BankCodeEnum;
import com.zerone.payment.common.facade.enums.CertTypeEnum;
import com.zerone.payment.common.facade.enums.PublicTagEnum;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;

/** @author glassescat <a href="">零一零一科技</a> */
@Getter
@Setter
@Entity
@Table(
  name = "merchant",
  indexes = {
    @Index(name = "unique_merchant_id", columnList = "merchant_id", unique = true),
    @Index(name = "unique_email", columnList = "email", unique = true),
    @Index(name = "unique_mobile", columnList = "mobile", unique = true)
  }
)
public class MerchantEntity extends AbstractEntity {

  /** 上级商户ID */
  @Column(name = "parent_merchant_id", columnDefinition = "varchar(20) not null comment '上级商户ID'")
  private String parentMerchantId;

  /** 商户名称 */
  @Column(name = "merchant_name", columnDefinition = "varchar(256) not null comment '商户名称'")
  private String merchantName;

  /** 商户类型 */
  @Column(
    name = "merchant_type",
    columnDefinition = "varchar(256) not null default 'NORMAL_MERCHANT'comment '商户类型'"
  )
  @Enumerated(EnumType.STRING)
  private MerchantTypeEnum merchantType;

  /** 商户ID */
  @Column(name = "merchant_id", columnDefinition = "varchar(20) not null comment '商户ID'")
  private String merchantId;

  /** 商户资金账号 */
  @Column(name = "account_no", columnDefinition = "varchar(20) comment '商户资金账号'")
  private String accountNo;

  /** 联系人 */
  @Column(name = "contact", columnDefinition = "varchar(32) comment '联系人'")
  private String contact;

  /** 手机号 */
  @Column(name = "mobile", columnDefinition = "varchar(18) comment '手机号'")
  private String mobile;

  /** 邮箱 */
  @Column(name = "email", columnDefinition = "varchar(128) comment '邮箱'")
  private String email;

  /** 营业执照号 */
  @Column(name = "licence_no", columnDefinition = "varchar(128) comment '营业执照号'")
  private String licenceNo;

  /** 营业执照图片地址 */
  @Column(name = "licence_path", columnDefinition = "varchar(256) comment '营业执照图片地址'")
  private String licencePath;

  /** 经营范围 */
  @Column(name = "bus_scope", columnDefinition = "varchar(512) comment '经营范围'")
  private String busScope;

  /** 经营类目 */
  @Column(name = "category", columnDefinition = "varchar(512) comment '经营类目'")
  private String category;

  /** 经营商品 */
  @Column(name = "goods", columnDefinition = "varchar(1024) comment '经营商品'")
  private String goods;

  /** 地址 */
  @Column(name = "address", columnDefinition = "varchar(512) comment '地址'")
  private String address;

  /** 法人姓名 */
  @Column(name = "legal_name", columnDefinition = "varchar(512) comment '法人姓名'")
  private String legalName;

  /** 法人证件类型 */
  @Enumerated(EnumType.STRING)
  @Column(name = "legal_cert_type", columnDefinition = "varchar(64) comment '法人证件类型'")
  private CertTypeEnum legalCertType;

  /** 法人证件号 */
  @Column(name = "legal_cert_no", columnDefinition = "varchar(32) comment '法人证件号'")
  private String legalCertNo;

  /** 法人证件正面图片地址 */
  @Column(name = "legal_cert_front_path", columnDefinition = "varchar(256) comment '法人证件正面图片地址'")
  private String legalCertFrontPath;

  /** 法人证件反面图片地址 */
  @Column(name = "legal_cert_back_path", columnDefinition = "varchar(256) comment '法人证件反面图片地址'")
  private String legalCertBackPath;

  /** 法人证件到期时间 */
  @Column(name = "法人证件到期时间", columnDefinition = "varchar(32) comment '法人证件到期时间'")
  private String legalCertValidDate;

  /** 银行编码 */
  @Enumerated(EnumType.STRING)
  @Column(name = "bank_code", columnDefinition = "varchar(32) comment '银行编码'")
  private BankCodeEnum bankCode;

  /** 银行卡账户名 */
  @Column(name = "bank_card_name", columnDefinition = "varchar(64) comment '银行卡账户名'")
  private String bankCardName;

  /** 银行卡号 */
  @Column(name = "bank_card_no", columnDefinition = "varchar(64) comment '银行卡号'")
  private String bankCardNo;

  /** 银行卡类型 */
  @Enumerated(EnumType.STRING)
  @Column(name = "bank_card_type", columnDefinition = "varchar(64) comment '银行卡类型'")
  private BankCardTypeEnum bankCardType;

  /** 开户省 */
  @Column(name = "bank_province", columnDefinition = "varchar(64) comment '开户省'")
  private String bankProvince;

  /** 开户市 */
  @Column(name = "bank_city", columnDefinition = "varchar(64) comment '开户市'")
  private String bankCity;

  /** 银行账户类型 */
  @Enumerated(EnumType.STRING)
  @Column(name = "bank_account_type", columnDefinition = "varchar(64) comment '银行账户类型'")
  private PublicTagEnum bankAccountType;
}
